package deanandjames.ui;

import java.awt.*;
import java.util.ArrayList;
import java.util.List;

public class Background {
	private static final Color colour = Color.black;
	private final int height;
	private final List<Star> stars;
	private final int width;

	public Background(int width, int height, int numberOfStars) {
		this.width = width;
		this.height = height;
		stars = new ArrayList<Star>(numberOfStars);
		for (int i = 0; i < numberOfStars; i++) {
			stars.add(new Star(Color.yellow, (int) (Math.random() * width), (int) (Math.random() * height)));
		}
	}

	public void draw(Graphics2D graphics) {
		graphics.setColor(colour);
		graphics.fillRect(0, 0, width, height);
		for (Star star : stars) {
			star.draw(graphics);
		}
	}

	public Color getColour() {
		return colour;
	}
}
